package mfuny.ggongal.admin;

import mfuny.ggongal.admin.etc.ZipService;
import mfuny.ggongal.admin.manager.Manager;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;

@Controller
public class ManagerController {
	Manager manager;
	ZipService zip;
	
	public ManagerController() throws Exception {
		manager = new Manager();
		zip = new ZipService();
	}
	
	@RequestMapping("/httpManager.ga")
	public ModelAndView httpManager() throws Exception {
		return new ModelAndView("/http/httpManager");
	}
	
	@RequestMapping("/setServerForm.ga")
	public ModelAndView setServerForm() throws Exception {
		return manager.setServerForm();
	}
	
	@RequestMapping("/setServer.ga")
	public ModelAndView setServer() throws Exception {
		return new ModelAndView("/server/setServer");
	}
	
	@RequestMapping("/previewForIE9.ga")
	public ModelAndView previewForIE9(MultipartFile imgt) throws Exception {
		return manager.previewForIE9(imgt);
	}
	
	@RequestMapping("/zipPopup.ga")
	public ModelAndView zipPopup() throws Exception {
		return zip.zipPopup();
	}
	
	@RequestMapping("/searchDongList.ga")
	public ModelAndView searchDongList(String dong) throws Exception {
		return zip.searchDongList(dong);
	}
	
	@RequestMapping("/fileUploadForm.ga")
	public ModelAndView fileUploadForm(int index) throws Exception {
		return manager.fileUploadForm(index);
	}
	
	@RequestMapping("/fileUploader.ga")
	public ModelAndView fileUploader(MultipartFile file, int index) throws Exception {
		return manager.fileUploader(file, index);
	}
	
	@RequestMapping("/fileDelete.ga")
	public ModelAndView fileDelete(String path) throws Exception {
		return manager.fileDelete(path);
	}
}
